﻿namespace TextFiles
{
    using System;
    using System.IO;

    class InsertNumberLines
    {
        // 1.2.12.03. Write a program that reads a text file and inserts line numbers in front of each of its lines.
        // The result should be written to another text file.

        static void Main()
        {
            StreamReader sr = new StreamReader(@"../../App.config");
            StreamWriter sw = new StreamWriter(@"../../output.txt");

            int lineNum = 0;
            string line = sr.ReadLine();
            while (line != null)
            {
                lineNum++;

                string forInsert = String.Format("{0}. {1}", lineNum, line);
                sw.WriteLine(forInsert);
                line = sr.ReadLine();
            }
            sr.Close();
            sw.Close();
        }
    }
}